﻿@model IEnumerable<PartyManagement.Models.Event>
@using PartyManagement.Models;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_MyLayout.cshtml";
   
     Event even = new Event();
    string mess=  ViewBag.mess as string ;
    
}
<header>
    
    
      @*  @Scripts.Render("~/bundles/jqueryval")*@ 
        @Styles.Render("~/Content/bookEvent.css")

    
    <script src="~/Scripts/jquery-ui-1.8.24.js"></script>
</header>
<h2>Events</h2>

<table>
    <tr>
       
        <th>
            @Html.DisplayNameFor(model => model.eventName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.dateEvent)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.endDateBook)
        </th>
      
   
           
    </tr>

@foreach (var item in Model) {
 
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.eventName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.dateEvent)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.endDateBook)
        </td>
        <td>
             @Html.Hidden("userID",Session["userID"])
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.eventID }) |
         
            @Html.ActionLink("Delete", "Delete", new { id=item.eventID }) |

      
            @if(item.hasMenu==true)
            {
                 @Html.ActionLink("Show Menu", "GetMenuForEvent", "Menu",new { eventID=item.eventID },null) 
            
            }else{
        
               @Html.ActionLink("Create Menu", "Create", "Menu",new { id=item.eventID,eventName=item.eventName  },null) 
                    
            }
          
            @Html.ActionLink("Invite", "Index", "GroupMember",new { id=item.eventID,eventName=item.eventName  },null) 

             @Html.ActionLink("Show Member", "showMember", "GroupMember",new { eventID=item.eventID },null) 


        </td>
    </tr>
    
}

</table>



<p>
    
   <input value="Create Event" class="actCreate" type="button" />
</p>

<script>
    $(document).ready(function () {
        $(".create").hide()
        $(".actCreate").click(function () {
            $(".create").show();
            $(".editor-field").val("");
           
        });

        $("input[name='saveEvent']").submit(function () {
            $('table').load()
        });
        //-------------------------------------------------------------
        $(".addgroup").hide();

        $(".link_add_group").click(function () {
            $(".addgroup").show();
        });
    });
   
</script>

<div class="create">

@using (Html.BeginForm("Create","BookEvent",FormMethod.Post)) {
    @Html.ValidationSummary(true)
 
    <fieldset class="fieldsetEvent">
        <legend>Event</legend>

        <div class="editor-label">
            @Html.LabelFor(model => even.eventName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => even.eventName)
            @Html.ValidationMessageFor(model => even.eventName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => even.dateEvent)

        </div>
        <div class="editor-field">
            @Html.EditorFor(model => even.dateEvent)
             <script>
                 //$(function () {
                 $("#even_dateEvent").datepicker();
                 //});
              </script>
            
            @Html.ValidationMessageFor(model => even.dateEvent)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => even.endDateBook)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => even.endDateBook)
            @Html.ValidationMessageFor(model => even.endDateBook)
             <script>
                 $(function () {
                     $("#even_endDateBook").datepicker();
                 });
            </script>
        </div>


        <div class="editor-field">
           @Html.Hidden("userID",Session["userID"])
        </div>

        <p>
            <input type="submit" value="Save" name="saveEvent"   />
        </p>
    </fieldset>
   
}

</div>


<div>
    @Html.ActionLink("Back to List", "Index")
</div>

  